home *** CD-ROM | disk | FTP | other *** search
- on LoseExt textstr
- set dot to offset(".", textstr)
- if dot > 1 then
- set textstr to chars(textstr, 1, dot - 1)
- end if
- return textstr
- end
-
- on HandleKey psKey, psInputString
- if voidp(psInputString) then
- set psInputString to EMPTY
- end if
- if psKey = BACKSPACE then
- delete char length(psInputString) of psInputString
- else
- set psKey to UpCase(psKey)
- set liAsciiCh to charToNum(psKey)
- if (liAsciiCh >= 65) and (liAsciiCh <= 90) then
- put psKey after psInputString
- end if
- end if
- return psInputString
- end
-
- on TypeWord psActiveWord, piStart, piLen
- if voidp(piLen) then
- set piLen to length(psActiveWord)
- end if
- set liWordSize to length(psActiveWord)
- repeat with liCnt = 1 to piLen
- set liSpriteNum to liCnt + piStart - 1
- if liCnt <= liWordSize then
- set lsChar to char liCnt of psActiveWord
- set liCastNum to the number of cast lsChar
- if the castNum of sprite liSpriteNum <> liCastNum then
- puppetSprite(liSpriteNum, 0)
- puppetSprite(liSpriteNum, 1)
- set the castNum of sprite liSpriteNum to liCastNum
- updateStage()
- end if
- next repeat
- end if
- puppetSprite(liSpriteNum, 0)
- end repeat
- end
-
- on UpCase psChar
- set liAsciiCh to charToNum(psChar)
- if (liAsciiCh >= 97) and (liAsciiCh <= 122) then
- set liAsciiCh to liAsciiCh - 32
- end if
- if (liAsciiCh >= 32) and (liAsciiCh <= 125) then
- return numToChar(liAsciiCh)
- else
- return EMPTY
- end if
- end
-
- on SwapSprite pSpriteNum, pCastName
- if the number of cast pCastName = -1 then
- exit
- end if
- set pSpriteNum to value(pSpriteNum)
- set lPuppetState to the puppet of sprite pSpriteNum
- if lPuppetState = 0 then
- puppetSprite(pSpriteNum, 1)
- end if
- set lCastNumber to the number of cast pCastName
- set the castNum of sprite pSpriteNum to lCastNumber
- end
-
- on killSprites low, high
- if the paramCount = 0 then
- set low to 1
- set high to 48
- end if
- repeat with t = low to high
- puppetSprite(t, 0)
- end repeat
- end
-
- on SSelect pOffSet
- return the clickOn - pOffSet + 1
- end
-
- on makefilename textstr, extstr
- if voidp(extstr) then
- set lRetName to chars(textstr, 1, 8)
- else
- set lRetName to chars(textstr, 1, 8) & "." & chars(extstr, 1, 3)
- end if
- return lRetName
- end
-
- on MakeList prefix, suffix, Num
- set FileList to makefilename(prefix & "1", suffix)
- repeat with i = 2 to Num
- set textstr to prefix & string(i)
- set fileName to makefilename(textstr, suffix)
- put the itemDelimiter & fileName after FileList
- end repeat
- return FileList
- end
-
- on MakeItemList pNum, pValue
- if voidp(pValue) then
- set pValue to 0
- end if
- set lRetStr to pValue
- repeat with i = 2 to pNum
- put "," & pValue after lRetStr
- end repeat
- return lRetStr
- end
-
- on holdSound schannel
- if voidp(schannel) then
- set schannel to 1
- end if
- repeat while soundBusy(schannel)
- nothing()
- end repeat
- end
-
- on repeat4Sound pFrame, schannel
- if voidp(pFrame) then
- set pFrame to 0
- end if
- if voidp(schannel) then
- set schannel to 1
- end if
- if soundBusy(schannel) then
- go(the frame - pFrame)
- end if
- end
-
- on RandomSound NameList
- global gLastRandomPlay
- set itemcnt to the number of items in NameList
- set itemnum to random(itemcnt)
- repeat while itemnum = gLastRandomPlay
- set itemnum to random(itemcnt)
- end repeat
- set gLastRandomPlay to itemnum
- set soundname to item itemnum of NameList
- PlayAudio(soundname)
- repeat4Sound()
- end
-
- on mousesound
- global MSound
- PlayAudio(MSound)
- holdSound()
- puppetSound(0)
- end
-
- on PlayAudio psAudio
- sound stop 1
- puppetSound(0)
- if not voidp(psAudio) then
- if the number of cast psAudio <> -1 then
- puppetSound(psAudio)
- updateStage()
- else
- sound playFile 1, psAudio
- end if
- else
- beep(1)
- end if
- end
-
- on MoviePlay pMovieName, pLabelName
- global gJumpFrame, gJumpName
- if pMovieName <> 1 then
- set gJumpFrame to the frame
- set gJumpName to the movieName
- if voidp(pLabelName) then
- set pLabelName to 1
- end if
- go(pLabelName, pMovieName)
- else
- go(gJumpFrame, gJumpName)
- end if
- end
-
- on WaitaSec piTime
- startTimer()
- repeat while the timer < (60 * piTime)
- nothing()
- end repeat
- end
-